/*
 * This file is part of LiteLoader.
 * Copyright (C) 2012-16 Adam Mummery-Smith
 * All Rights Reserved.
 */
package com.mumfrey.liteloader.modconfig;

import java.io.File;

import com.google.gson.GsonBuilder;

/**
 * Interface for Exposables which want a finer degree of control over the
 * serialisation process.
 *
 * @author Adam Mummery-Smith
 */
public interface AdvancedExposable extends Exposable
{
    /**
     * Allows this object to configure the GsonBuilder prior to the construction
     * of the Gson instance. Use this callback to (for example) register custom
     * type adapters or set other Gson options such as pretty printing.
     * 
     * @param gsonBuilder
     */
    public abstract void setupGsonSerialiser(GsonBuilder gsonBuilder);

    /**
     * Allows this object to specify an alternative configuration file to the
     * one determined by the writer, either return null or return configFile to
     * keep the original setting, or return a new File object to set the
     * location for the config file. If you specify an alternative location, you
     * are responsible for ensuring that the location exists and is writable. 
     * 
     * @param configFile Default config file, generated by the ExposableOptions
     *          for this Exposable
     * @param configFileLocation Default config file location, from the config
     *          strategy
     * @param defaultFileName Default cfg file name, from the ExposableOptions
     * @return config file location to return, return null to use the default
     */
    public abstract File getConfigFile(File configFile, File configFileLocation, String defaultFileName);
}
